package joke.servlet;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import joke.deal.DoNewImage;

public class NewScaleImageServlet extends HttpServlet {
	private static final String CONTENT_TYPE = "text/html; charset=UTF-8 ";

	private static final long serialVersionUID = 1L;

	public void init(ServletConfig config) throws ServletException {
		super.init(config);
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType(CONTENT_TYPE);
		ServletOutputStream out = response.getOutputStream();
		try {
			String id = request.getParameter("id");
			DoNewImage dn=new DoNewImage();
			dn.updateComicMagic(id);
			byte buf[] = new byte[] { 1, 2 };
			out.write(buf);
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}finally {
			try {
				if (out != null)
					out.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}
}
